﻿@model WeberTimeTracker.Models.Time

@{
    ViewBag.Title = "Work On Project";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Work On a Project</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Choose a Project</legend>
        
        <p>User</p>
        
        <div class="editor-field">
            @Html.DropDownList("User_ID", (SelectList)ViewBag.UserId, "--Select One--") 
            @Html.ValidationMessageFor(model => model.User_ID)
        </div>

        <p>Project Name</p>

        <div class="editor-field">
            @Html.DropDownList("Project_ID", (SelectList)ViewBag.ProjectId, "--Select One--") 
            @Html.ValidationMessageFor(model => model.Project_ID)
        </div>

        <p>
            <input type="submit" value="Choose" id="choose" />
        </p>
    </fieldset>
}


<script type = "text/javascript">
   
        var x = document.getElementById("Project_ID")

        @{ if ((bool)Session["pop"] == false) { <text>x.disabled = false</text>} } 
        @{ if ((bool)Session["pop"] == true) { <text>x.disabled = true</text>} } 

        var y = document.getElementById("User_ID")
        @{ if ((bool)Session["pop"] == false) { <text>y.disabled = false</text>} } 
        @{ if ((bool)Session["pop"] == true) { <text>y.disabled = true</text>} } 

        var z = document.getElementById("choose")
        @{ if ((bool)Session["pop"] == false) { <text>z.disabled = false</text>} } 
        @{ if ((bool)Session["pop"] == true) { <text>z.disabled = true</text>} } 
</script>
